package com.commerce.controller.back.classify;

import com.commerce.authority.AuthType;
import com.commerce.authority.Authority;
import com.commerce.model.Classify;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 类型控制器
 */
@Controller
@RequestMapping(value = "/admin/classify" , method = RequestMethod.POST)
public class ClassifyController {

    /**
     * 列表页面
     * @return String
     */
    @RequestMapping("list")
    @Authority(AuthType.CLASSIFY_SELECT)
    public String list(){
        return "back/classify/list";
    }

    @ResponseBody
    @RequestMapping("pageList")
    @Authority(AuthType.CLASSIFY_SELECT)
    public String  pageList(){
        return "";
    }

    /**
     * 修改或新增页面
     * @param id
     * @param model
     * @return
     */
    @RequestMapping("info")
    @Authority({AuthType.CLASSIFY_INSERT,AuthType.CLASSIFY_UPDATE})
    public String info(Integer id , Model model){
        Classify classify = null;
        if(id != null && id > 0 )
            classify = new Classify();
        model.addAttribute("classify",classify);
        return "back/classify/info";
    }

    /**
     * 新增
     * @param classify
     * @return
     */
    @ResponseBody
    @RequestMapping("addClassify")
    @Authority(AuthType.CLASSIFY_INSERT)
    public String addClassify(Classify classify){
        return null;
    }

    /**
     * 修改
     * @param classify
     * @return
     */
    @ResponseBody
    @RequestMapping("editClassify")
    @Authority(AuthType.CLASSIFY_UPDATE)
    public String editClassify(Classify classify){
        return null;
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("delClassify")
    @Authority(AuthType.CLASSIFY_DELETE)
    public String delClassify(int id){
        return null;
    }
}
